<template>
    <div class="">
        <el-container class="form-container" style="">
            <el-card class="box-card" shadow="never">
                <div slot="header" class="clearfix">
                    <span>部门信息</span>
                    <el-button type="primary" size="mini" style="float:right;padding: 6px 9px;" @click="handlerEdit">编辑</el-button>
                </div>
                <div >
                   <el-form  :rules="rules"  ref="form"   :model="form" size="small" label-width="120px">
                        <el-row>
                            <el-col :span="12">
                                <el-form-item  label="名称"  prop="fdName">
                                    {{form.fdName}}
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item  label="编号"  prop="fdNo">
                                    {{form.fdNo}}
                                </el-form-item>
                            </el-col>
                        </el-row>
                            <el-row>
                            <el-col :span="12">
                            <el-form-item  label="上级部门"  prop="fdParentName">
                                    
                                    {{form.fdParentName}}
                                </el-form-item>
                            </el-col>
                            <el-col :span="12">
                            <el-form-item  label="所属机构"  prop="fdParentOrgName">
                                    {{form.fdParentOrgName}}
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                            <el-form-item  label="是否有效" prop="fdIsAvaliable">
                                {{form.fdIsAvaliable==='true'?'是':'否'}}
                            </el-form-item>
                            </el-col>
                            <el-col :span="12">
                                <el-form-item  label="排序号"  prop="fdOrder">
                                    {{form.fdOrder}}
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="12">
                                <el-form-item  label="创建时间" prop="fdCreateTime">
                                    {{form.fdCreateTime | formatDate}}
                                </el-form-item>
                            </el-col>
                        </el-row>
                   </el-form>
                </div>
            </el-card>
        </el-container>
    </div>
</template>
<script>
import dateUtils from '@/utils/dateUtils';
import formUtils from '@/utils/formUtils';
export default {
    name: "SysOrgDeptAdd",
    components: {
    },
    data() {
        return {
            form: {
                fdOrder:'',
                fdCreateTime:'',
                fdLeaderName:'',
                fdParentId:'',
                fdParentOrgId:'',
                fdParentOrgName:'',
                fdParentName:'',
                fdLeaderId:'',
                fdNo:'',
                fdName:'',
                fdIsAvaliable:'',
                fdId:''
            },
            labelPosition:'right',
            fullscreenLoading:false
        }
    },
    created() {
        this.initParam();
    },
    methods: {
        handlerEdit() {
            const params = {
                path: "/sys/org/sys_org_dept/edit",
                query: {id:this.form.fdId}
            }
            this.$router.push(params);
        },
        initParam() {
            let fdId = this.$route.query.id;
            if(formUtils.isNotEmpty(fdId)){
                this.fullscreenLoading = true;
                this.$fetch('/api/sys/org/sys_org_dept',{
                    id:fdId
                }).then((res) => {
                    formUtils.convertToForm(res.data,this.form);
                    this.fullscreenLoading = false;
                });
            }
        }
    },
    filters:{
        formatDate(time) {
            return dateUtils.formatDate(time);
        }
    }
}
</script>
<style scoped >
@import "~@/assets/css/form.css";
</style>